package com.minyifang.wcspf.work.ui.user.presenter;

import com.minyifang.wcspf.common.base.BasePresenter;
import com.minyifang.wcspf.common.config.network.Constants;
import com.minyifang.wcspf.common.config.network.RetrofitHelper;
import com.minyifang.wcspf.common.config.user.UserManager;
import com.minyifang.wcspf.work.ui.user.view.MyWalletView;
import com.minyifang.wcspf.work.ui.user.view.ServiceView;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public class ServicePresenter extends BasePresenter<ServiceView> {

    public void getData() {
        getView().showLoadingView();
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), Constants.getJsonData(null, UserManager.getInstance().getToken()).toString());
        addTask(RetrofitHelper.getInstance().getService().getServiceData(requestBody), respond -> {
            getView().hideLoadingView();
            if (respond.result == 1) {
                getView().showDataRes(respond.data);
            } else
                getView().showRequestFailed(respond.message);
        });
    }
}
